package com.dx.wx.service.impl;

import com.dx.wx.service.DxSaleService;
import com.dx.wx.util.DxUtil;
import com.ejlchina.data.Array;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class DxSaleServiceImpl implements DxSaleService {

    @Override
    public Array list(Long startDate, Long endDate, Long phone) {
        Map startDateFilter = null;
        Map endDateFilter = null;
        if (startDate != null && endDate != null) {
            startDateFilter = new HashMap();
            startDateFilter.put("field_name", "date__c");
            startDateFilter.put("field_values", startDateFilter);
            startDateFilter.put("operator", "GTE");
            endDateFilter = new HashMap();
            endDateFilter.put("field_name", "date__c");
            endDateFilter.put("field_values", endDateFilter);
            endDateFilter.put("operator", "LTE");
        }
        Map data = DxUtil.createSearchData(startDateFilter, endDateFilter);
        data.put("dataObjectApiName", "ActiveRecordObj");
        return DxUtil.findSimple(data);
    }
}
